<template>
  <socket ref="socket"/>
</template>

<script>
import socket from "../socket/WebSocket.vue";

export default {
  name: "SdkOperate",
  components: {socket},
  data() {
    return {
      // 初始化窗口定时器
      createDlgInstances: '',
    }
  },
  methods: {
    // 初始化控件
    initializePlugin: function (callback) {
      this.$refs.socket.sendMsg('NETDEV_DlgInit', {"strServerIP": ""}, callback);
    },
    // 初始化窗口，可能会失败
    initializeWindow: function (param, callback) {
      const _this = this;
      _this.createDlgInstances = setTimeout(function () {
        _this.$refs.socket.sendMsg('NETDEV_CreateDlg', param, callback)
      }, 300);
    },
    // 开启分屏
    splitScreen: function (param, callback) {
      window.clearTimeout(this.createDlgInstances);
      this.$refs.socket.sendMsg('NETDEV_SetWndMode', param, callback);
    },
    // 登录
    devLogin: function (param, callback) {
      this.$refs.socket.sendMsg('NETDEV_Login_V30', param, callback);
    },
    // 获取摄像头列表查询句柄
    findCameraListHandle: function (param, callback) {
      this.$refs.socket.sendMsg('NETDEV_FindDevChnList', param, callback);
    },
    // 获取摄像头列表
    queryCameraList: function (param, callback) {
      this.$refs.socket.sendMsg('NETDEV_FindNextDevChn', param, callback);
    },
    // 关闭摄像头查询
    closeCameraQuery: function (param, callback) {
      this.$refs.socket.sendMsg('NETDEV_FindCloseDevChn', param, callback);
    },
    // 获取焦点窗口
    getsFocusWindow: function (param, callback) {
      this.$refs.socket.sendMsg('NETDEV_GetFocusWnd', param, callback);
    },
    // 停止实时预览
    stopPreviewing: function (param, callback) {
      this.$refs.socket.sendMsg('NETDEV_StopRealPlay', param, callback);
    },
    // 开启实时预览
    openPreviewing: function (param, callback) {
      this.$refs.socket.sendMsg('NETDEV_RealPlay', param, callback);
    },
    //设备注销
    devLoginOut: function (param, callback) {
      this.$refs.socket.sendMsg('NETDEV_Logout', param, callback);
    }
  }
}
</script>

<style scoped>

</style>